package com.atguigu.mapper;

import com.atguigu.base.BaseMapper;
import com.atguigu.entity.RolePermission;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 权限分配Mapper
 */
public interface RolePermissionMapper extends BaseMapper<RolePermission> {
    /**
     * 查询角色所拥有的权限id的集合
     * @param roleId
     * @return
     */
    List<Long> findPermissionIdListByRoleId(Long roleId);

    /**
     * 将中间表中角色和权限的关系删除
     * @param roleId
     */
    void deleteByRoleId(Long roleId);
    /**
     * 为角色重新分配权限
     * @param roleId
     * @param permissionIds
     */
    void assignPermission(@Param("roleId") Long roleId, @Param("permissionIds") List<Long> permissionIds);
}
